<?php
/**
 * 公众号页面授权接口
 * @author lss
 * 2017-03-02
 */
namespace soa\mp\push;

use soa\client;

class Order  extends client
{
    /**
     * 服务地址
     * @var string
     */
    public $service_url = 'http://mp.kuaidihelp.com/';

    /**
     * 服务名称
     * @var string
     */
    protected $service_name = 'kuaidihelp_mp';

	/**
	 * 回填单号推送
	 * @param $orderId
	 * @return array|bool|null
	 */
	public function addWaybill($orderId){
		if(!empty($orderId) && is_string($orderId) && preg_match('/^\d+$/',$orderId)){
			return $this->post("api/push/Order/addWaybill",[
				"order_id" => $orderId,
			]);
		}
		return [];
	}

	/**
	 * 抢单结果通知
	 * @param $orderId
	 * @return array|bool|null
	 */
	public function grabOrder($orderId){
		if(!empty($orderId) && is_string($orderId) && preg_match('/^\d+$/',$orderId)){
			return $this->post("api/push/Order/grabOrder",[
				"order_id" => $orderId,
			]);
		}
		return [];
	}

	/**
	 * 取消订单推送消息
	 * @param $orderId
	 * @return array|bool|null
	 */
	public function cancelOrder($orderId){
		if(!empty($orderId) && is_string($orderId) && preg_match('/^\d+$/',$orderId)){
			return $this->post("api/push/Order/cancelOrder",[
				"order_id" => $orderId,
			]);
		}
		return [];
	}
}